function validate_mail() {

		var at="@"
		var dot="."
		var lat=document.getElementById("mail").value.indexOf("@")
		var lstr=document.getElementById("mail").length
		var ldot=document.getElementById("mail").value.indexOf(dot)
		var str=document.getElementById("limba")
		str=str.innerHTML
		if (str=="ro"){
			error="Adresa de e-mail incorecta!"
		}
		else {
			error="Invalid E-mail ID"
		}
		if (document.getElementById("mail").value.indexOf(at)==-1){
		   alert(error)
		   
		   return false
		    
		}

		if (document.getElementById("mail").value.indexOf(at)==-1 || document.getElementById("mail").value.indexOf(at)==0 || document.getElementById("mail").value.indexOf(at)==lstr){
		   alert(error)
		    
		   return false
		    
		}

		if (document.getElementById("mail").value.indexOf(dot)==-1 || document.getElementById("mail").value.indexOf(dot)==0 || document.getElementById("mail").value.indexOf(dot)==lstr){
		    alert(error)
			 
		    return false
			 
		}

		 if (document.getElementById("mail").value.indexOf(at,(lat+1))!=-1){
		    alert(error)
			 
		    return false
			 
		 }

		 if (document.getElementById("mail").value.substring(lat-1,lat)==dot || document.getElementById("mail").value.substring(lat+1,lat+2)==dot){
		    alert(error)
			 
		    return false
			 
		 }

		 if (document.getElementById("mail").value.indexOf(dot,(lat+2))==-1){
		    alert(error)
			 
		    return false
			 
		 }
		
		 if (document.getElementById("mail").value.indexOf(" ")!=-1){
		    alert(error)
			 
		    return false
			 
		 }

 		 return true					
	}
	
	
	
	

